package com.main.bo;

import com.main.common.R;
import com.main.pojo.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

@Data
public class LoginBO<T> implements Serializable {

    @ApiModelProperty("编码")
    private Integer code; //编码：1成功，0和其它数字为失败

    @ApiModelProperty("错误信息")
    private String msg; //错误信息

    @ApiModelProperty("数据")
    private T data; //数据

    public static <T> LoginBO<T> success(T object) {
        LoginBO<T> loginBO = new LoginBO<T>();
        loginBO.data = object;
        loginBO.code = 1;
        return loginBO;
    }

    public static <T> LoginBO<T> error(String msg) {
        LoginBO<T> loginBO = new LoginBO<T>();
        loginBO.msg = msg;
        loginBO.code = 0;
        return loginBO;
    }

}
